//
//  NetTool.swift
//  AlamofireEncapsulate
//
//  Created by 李煜 on 2024/4/18.
//

import Alamofire
import UIKit

public typealias requestCallBack = () -> Void
struct HttpBinResponse: Decodable {
    let name: String
}

class NetTool {
    /// 网络请求
    /// - Parameters:
    ///   - method: GET / POST
    ///   - URLString: URLString
    ///   - parameters: 参数字典
    ///   - finished: 完成回调
    static func request(method: HTTPMethod,
                         URLString: String,
                         parameters: [String: Any]?,
                         finished: @escaping requestCallBack) {
        AF.request(URLString, method: method, parameters: parameters).responseDecodable(of: HttpBinResponse.self) { response in
            
            
//            switch response.result {
//            case let .success(data, _):
//                    finished
//                break
//            case let .failure(_ , error):
//                    finished(_, error)
//                break
//            }
        }
    }
}

//
extension NetTool {
}
